Refactor visualizations into modular files and added chord diagram support#72
Open
ssagili3 wants to merge 3 commits into
Open
Refactor visualizations into modular files and added chord diagram support#72ssagili3 wants to merge 3 commits into
ssagili3 wants to merge 3 commits into
Conversation
What changed: - Add visualize_attention_chord_diagrams.py for circular residue-residue attention diagrams. - Support per-head chord PNGs, an all-head small-multiples grid, and an aggregated mean chord diagram. - Build chord diagrams from the shared load_attention_map data structure added in the prior refactor. - Wire the sample heatmap/network demo script to also generate chord diagram outputs. - Document the chord_diagrams output folder and add tests for chord aggregation and PNG generation.
|
This is a super useful refactor! It centralizes the shared parsing in visualize_attention_data.py and separates every visualization type to its own module. One integration I have is since issue #41 also needs offline trace visualization through the WebUI, it might be helpful to expose a common intermediate data format from the shared parse. That way, the new chord/heatmap/network modules can easier reuse from the Streamlit frontend or future archive reader outputs without duplicating parsing or conversion logic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
##Refactor attention visualizations into modular modules and add chord diagram support
Summary
This PR delivers a modular visualization architecture for attention analysis and introduces chord diagrams as a new visualization method.
Each visualization type is now separated into its own file, with shared data parsing centralized for reuse. This improves maintainability, extensibility, and clarity while keeping compatibility with existing OpenFold attention output files.
Linked Issue
Closes #7
Scope
Core architecture changes
visualize_attention_arc_diagram_demo_utils.pyvisualize_attention_3d_demo_utils.pyvisualize_attention_head_heatmaps.pyvisualize_attention_networks.pyvisualize_attention_chord_diagrams.py(new)visualize_attention_data.pyNew functionality
Documentation and demo updates
examples/monomer/sample_attention_viz_outputs/README.mddocs/source/Head_Visualization_Heatmap_Network.mdTest coverage
tests/test_visualize_attention_data.pytests/test_visualize_attention_chord_diagrams.pyWhy this change
Functional impact
Testing and verification
A) Fastest end-to-end test (recommended)
The fastest and most reliable way to test all visualization updates is:
This single command validates the entire pipeline:
visualize_attention_data.py)visualize_attention_head_heatmaps.py)visualize_attention_networks.py)visualize_attention_chord_diagrams.py)scripts/run_head_heatmap_network_demo.py)This is the recommended primary test, as it confirms all components work together.
B) Environment setup for reproducibility
If dependencies are not already installed:
Tested with Python 3.9+ on macOS/Linux environments.
C) Expected console output (successful run)
A successful run should print messages similar to:
These confirm that each stage of the pipeline executed successfully.
D) Required artifact checks (file-level verification)
After running the demo, verify these files exist:
Optional: Confirm per-head chord diagrams exist:
chord_head_0_layer_47_6KWC.pngthroughchord_head_7_layer_47_6KWC.pngE) Visual sanity checks
Open generated images and verify: